import { computed,  ref } from 'vue'
import { EnumViewType } from "@renderer/assets/types";

interface IGlobalView {
  [key: string]: EnumViewType
}

const globalActiveView = ref<IGlobalView>({})

export const useActiveView = (viewId: string) => {
  initActiveView(viewId)
  function setActiveView(viewType: EnumViewType) {
    globalActiveView.value[viewId] = viewType
  }

  function initActiveView(viewId: string) {
    globalActiveView.value[viewId] = EnumViewType.ax
  }


  return {
    activeView: computed(() => globalActiveView.value[viewId]),
    setActiveView
  }

}
